package com.itheima.edu.info.manager.controller;

import com.itheima.edu.info.manager.domain.Student;
import com.itheima.edu.info.manager.util.AgeUtil;

import java.util.Scanner;

public class StudentController extends BaseStudentController {
    private Scanner sc = new Scanner(System.in);

    //输入学生信息并封装为学生对象的优化方法
    public Student inputStudentinfo(String id) {

        System.out.println("请输入新的学生姓名：");
        String name = sc.next();

        System.out.println("请输入新的学生出生日期：");
        String birthday = sc.next();

        //调用年龄工具类方法，根据出生日期计算年龄
        String age = AgeUtil.getAge(birthday);


        //4.根据新的学生信息封装新的学生对象
        Student Stu = new Student(id, name, age, birthday);
        return Stu;
    }

}
